package com.qining618.cms.ucenter.controller.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qining618.cms.ucenter.domain.Token;
import com.qining618.cms.ucenter.service.TokenService;
import com.qining618.common.annotation.Access;
import com.qining618.common.result.ApiResult;
import com.qining618.common.result.TableData;
import com.qining618.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Description;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 登录凭证管理 前端控制器
 * </p>
 *
 * @author qining
 * @since 2019-09-16
 */
@RestController
@RequestMapping("/admin/api/ucenter/token")
public class AdminTokenController {

    @Autowired
    private TokenService tokenService;

    @Access(needAdmin = true)
    @GetMapping(value = "page")
    @Description("分页")
    public ApiResult page(@RequestParam Map<String, Object> params) {
        Query<Token> query = new Query<>(params);

        IPage<Token> pageInfo = tokenService.page(query.getPage(), query.getQueryWrapper());

        return ApiResult.ok(TableData.of(pageInfo));
    }

}

